/*    */ package my.rummyInterface;
/*    */ 
/*    */ import java.awt.Color;
/*    */ import java.awt.Dimension;
/*    */ import java.awt.Font;
/*    */ import java.awt.GridLayout;
/*    */ import java.awt.event.ActionEvent;
/*    */ import java.awt.event.ActionListener;
/*    */ import javax.swing.BorderFactory;
/*    */ import javax.swing.JButton;
/*    */ import javax.swing.JOptionPane;
/*    */ import javax.swing.JPanel;
/*    */ import javax.swing.JTextField;
/*    */ import javax.swing.border.TitledBorder;
/*    */ 
/*    */ public class PanelAgregarJugador extends JPanel
/*    */   implements ActionListener
/*    */ {
/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
/* 29 */   public static String AGREGAR = "AGREGAR";
/*    */   private RummyInterface principal;
/*    */   private JTextField txtNombre;
/*    */   private JButton btnAgregar;
/*    */ 
/*    */   public PanelAgregarJugador(RummyInterface principalP)
/*    */   {
/* 42 */     this.principal = principalP;
/*    */ 
/* 45 */     TitledBorder borde = BorderFactory.createTitledBorder("Agregar Jugador");
/* 46 */     borde.setTitleColor(Color.BLUE);
/* 47 */     borde.setTitleFont(new Font("Arial", 1, 12));
/* 48 */     borde.setTitleJustification(2);
/* 49 */     borde.setBorder(BorderFactory.createEmptyBorder());
/* 50 */     setBorder(borde);
/*    */ 
/* 53 */     setLayout(new GridLayout(1, 2));
/*    */ 
/* 56 */     this.txtNombre = new JTextField("");
/* 57 */     this.txtNombre.addActionListener(this);
/* 58 */     this.txtNombre.setActionCommand(AGREGAR);
/* 59 */     this.txtNombre.setPreferredSize(new Dimension(90, 0));
/* 60 */     add(this.txtNombre);
/*    */ 
/* 62 */     this.btnAgregar = new JButton("Agregar");
/* 63 */     this.btnAgregar.addActionListener(this);
/* 64 */     this.btnAgregar.setActionCommand(AGREGAR);
/* 65 */     add(this.btnAgregar);
/*    */   }
/*    */ 
/*    */   public void actionPerformed(ActionEvent e)
/*    */   {
/* 74 */     String comando = e.getActionCommand();
/* 75 */     String nombre = this.txtNombre.getText();
/* 76 */     this.txtNombre.setText("");
/* 77 */     if (comando.equals(AGREGAR))
/*    */     {
/*    */       try
/*    */       {
/* 81 */         this.principal.agregarJugador(nombre);
/*    */       }
/*    */       catch (Exception ex)
/*    */       {
/* 85 */         JOptionPane.showMessageDialog(this.principal, ex.getMessage(), "Rummy", 0);
/*    */       }
/*    */     }
/*    */   }
/*    */ }

/* Location:           C:\Users\Yank\Documents\APO\Rummy\bin\
 * Qualified Name:     my.rummyInterface.PanelAgregarJugador
 * JD-Core Version:    0.6.0
 */